1 /* 2 * Copyright (c) 2011-2014 - Mauro Carvalho Chehab 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License as published by 6 * the Free Software Foundation version 2.1 of the License. 7 * 8 * This program is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * GNU Lesser General Public License for more details. 12 * 13 * These routines were originally written as part of the dvb-apps, as: 14 * util functions for various ?zap implementations 15 * 16 * Copyright (C) 2001 Johannes Stezenbach (js@convergence.de) 17 * for convergence integrated media 18 * 19 * Originally licensed as GPLv2 or upper 20 */ 21 22 /** 23 * @file dvb-demux.h 24 * @ingroup demux 25 * @brief Provides interfaces to deal with DVB demux. 26 * @copyright GNU Lesser General Public License version 2.1 (LGPLv2.1) 27 * @author Mauro Carvalho Chehab 28 * 29 * @par Bug Report 30 * Please submit bug reports and patches to linux-media@vger.kernel.org 31 */ 32 33 module libdvbv5_d.dvb_demux; 34 35 import libdvbv5_d.linux_dmx: dmx_pes_type_t, dmx_output_t; 36 37 extern (C): 38 39 /** 40 * @brief Opens a DVB demux in read/write mode 41 * @ingroup demux 42 * 43 * @param adapter DVB adapter number to open 44 * @param demux DVB demux number to open 45 * 46 * @details This is a wrapper function to open(). File is always opened in 47 * blocking mode. 48 * 49 * @return Returns a file descriptor on success, -1 otherwise. 50 * 51 * @warning Deprecated. Please use dvb_dev_open() instead. 52 */ 53 int dvb_dmx_open (int adapter, int demux); 54 55 /** 56 * @brief Stops the DMX filter for the file descriptor and closes 57 * @ingroup demux 58 * 59 * @param dmx_fd File descriptor to close 60 * 61 * This is a wrapper function to close(). 62 * 63 * @warning Deprecated. Please use dvb_dev_close() instead. 64 */ 65 void dvb_dmx_close (int dmx_fd); 66 67 /** 68 * @brief Stops the DMX filter for a given file descriptor 69 * @ingroup demux 70 * 71 * @param dmx_fd File descriptor to close 72 * 73 * This is a wrapper function to DMX_STOP ioctl. 74 * See http://linuxtv.org/downloads/v4l-dvb-apis/dvb_demux.html 75 * for more details. 76 * 77 * @warning Deprecated. Please use dvb_dev_dmx_stop() instead. 78 */ 79 void dvb_dmx_stop (int dmx_fd); 80 81 /** 82 * @brief Start a filter for a MPEG-TS Packetized Elementary 83 * Stream (PES) 84 * @ingroup demux 85 * 86 * @param dmxfd File descriptor for the demux device 87 * @param pid Program ID to filter. Use 0x2000 to select all PIDs 88 * @param type type of the PID (DMX_PES_VIDEO, DMX_PES_AUDIO, 89 * DMX_PES_OTHER, etc). 90 * @param output Where the data will be output (DMX_OUT_TS_TAP, 91 * DMX_OUT_DECODER, etc). 92 * @param buffersize Size of the buffer to be allocated to store the filtered data. 93 * 94 * This is a wrapper function for DMX_SET_PES_FILTER ioctl. 95 * See http://linuxtv.org/downloads/v4l-dvb-apis/dvb_demux.html 96 * for more details. 97 * 98 * @return Retuns zero on success, -1 otherwise. 99 * 100 * @warning Deprecated. Please use dvb_dev_dmx_set_pesfilter() instead. 101 */ 102 int dvb_set_pesfilter ( 103 int dmxfd, 104 int pid, 105 dmx_pes_type_t type, 106 dmx_output_t output, 107 int buffersize); 108 109 /** 110 * @brief Sets a MPEG-TS section filter 111 * @ingroup demux 112 * 113 * @param dmxfd File descriptor for the demux device 114 * @param pid Program ID to filter. Use 0x2000 to select all PIDs 115 * @param filtsize Size of the filter (up to 18 btyes) 116 * @param filter data to filter. Can be NULL or should have filtsize length 117 * @param mask filter mask. Can be NULL or should have filtsize length 118 * @param mode mode mask. Can be NULL or should have filtsize length 119 * @param flags flags for set filter (DMX_CHECK_CRC,DMX_ONESHOT, 120 * DMX_IMMEDIATE_START). 121 * 122 * This is a wrapper function for DMX_SET_FILTER ioctl. 123 * See http://linuxtv.org/downloads/v4l-dvb-apis/dvb_demux.html 124 * for more details. 125 * 126 * @warning Deprecated. Please use dvb_dev_dmx_set_pesfilter() instead. 127 * 128 * @return Retuns zero on success, -1 otherwise. 129 * 130 */ 131 int dvb_set_section_filter ( 132 int dmxfd, 133 int pid, 134 uint filtsize, 135 ubyte* filter, 136 ubyte* mask, 137 ubyte* mode, 138 uint flags); 139 140 /** 141 * @brief read the contents of the MPEG-TS PAT table, seeking for 142 * an specific service ID 143 * @ingroup demux 144 * 145 * @param dmxfd File descriptor for the demux device 146 * @param sid Session ID to seeking 147 * 148 * @warning Deprecated. Please use dvb_get_pmt_pid() instead. 149 * 150 * @return At return, it returns a negative value if error or the PID associated with 151 * the desired Session ID. 152 * 153 * @warning This function currently assumes that the PAT fits into one session. 154 */ 155 int dvb_get_pmt_pid (int dmxfd, int sid);